{% if search_results|length != 1 %}
<div class="search-count"><p>{{ search_count }} {% trans 'results for' %} '{{ term }}'</p></div>
{% endif %}
{% if search_results|length == 0 %}<p class="no-results">{% trans 'The search provided no results.' %}</p>{% endif %}

{% for concept in search_results %} {# loop through the hits #}
<div class="search-result">
  {% spaceless %}
    {% if vocab == '' and concept.vocab is defined %}
    <span class="prefLabel conceptlabel redirected-vocab-id">{{ concept.vocab }}: </span>
    {% endif %}
    {% if concept.foundBy %} {# hit has been found through an alt/hidden/another language label #}
    <span class="versal {% if concept.foundByType != 'lang' %}replaced{% endif %}">{{ concept.foundBy }}</span><span> >>&nbsp</span>
    <a class="prefLabel" href="{{ concept.uri | link_url(concept.vocab,lang) }}">{{ concept.label }}</a></span>
    {% else %}
    <a class="prefLabel conceptlabel" href="{% if concept.type == "skos:Collection" %}{{ concept.uri | link_url(concept.vocab, lang, 'groups') }}{% elseif concept.exvocab is defined%}{{ concept.uri | link_url(concept.exvocab,concept.lang) }}{% else %}{{ concept.uri | link_url(concept.vocab,concept.lang) }}{% endif %}">{{ concept.label }}</a>
    {% endif %}
  {% endspaceless %}
  {% if concept.type == 'skosext:DeprecatedConcept' %}<h2 class="deprecated-alert">{% trans %}deprecated{% endtrans %}</h2>{% endif %}
  {% for property in concept.properties %} {# loop through ConceptProperty objects #}
    {% if property.type in PreferredProperties %}
    <div class="property">
      <span class="property-click">
        <img class="property-hover" src="{{ path_fix }}resource/pics/{% if property.type == 'skos:broader' %}broader{% elseif property.type == 'skos:narrower' %}narrower{% elseif property.type == 'skos:altLabel' %}replaced{% elseif property.type == 'skos:related' %}cloud{% elseif property.type == 'onki:memberOf' %}group{% else %}globe{% endif %}.gif"><span class="property-mouseover" title="{{ property.description }}"></span>
      </span>
      {% set previous = false %}
      {% for propval in property.values %} {# loop through ConceptPropertyValue objects #}
        {% set outerLast = loop.last %}
          {% if propval.SubMembers %} {# if property is a group concept that has sub properties #}
            {% for sub_member in propval.SubMembers %}
              {% if previous != sub_member.label %}
              <span class="versal">{{ sub_member.label }}</span>{% if not outerLast %}<span class="versal">,</span>{% endif %}
              {% endif %}
              {% set previous = sub_member.label %}
            {% endfor %}
            {% else %}
              {% if propval.uri %} {# resources with URI #}
              {% spaceless %}
                {% if propval.label %}
                  {% if propval.exvocab and propval.exvocab != propval.vocab %}{# if the property is located in a another vocabulary #}
                  <span class="versal">{{ propval.label }}</span>
                  {% else %}
                  <span class="versal">{{ propval.label|trans }}</span>
                  {% endif %}
                  {% if propval.lang and propval.lang != lang %}<span class="versal"> ({{ propval.lang }})</span>{% endif %}{% if not loop.last %}<span class="versal">,</span>{% endif %}
                {% endif %}
              {% endspaceless %}
              {% else %} {# Literals (no URI), eg. alternative labels as properties #}
                  <span class="versal">{{ propval.label }}{% if not loop.last %},{% endif %}</span>
              {% endif %}
          {% endif %}
      {% endfor %}
    </div>
    {% endif %}
  {% endfor %}
  {% if concept.foreignPrefLabels %}
    <div class="property">
      <span class="property-click"><span class="property-mouseover" title="{% trans "foreign prefLabel help" %}"></span>
        <img class="property-hover" src="{{ path_fix }}resource/pics/globe.gif">
      </span>
      {% for lang,labels in concept.foreignPrefLabels %}
        {% for label in labels %}
        <span class="versal">{{ label }} ({{ lang }})</span>
        {% endfor %}{% if loop.last == false %}<span class="versal">,</span>{% endif %}
      {% endfor %}
    </div>
  {% endif %}
  {% if concept.uri %}
    <div><span class="versal uri-input-box">{{ concept.uri }}</span></div>
  {% endif %}
</div>
{% endfor %}
